package com.evaluation_system.service.impl;

import com.evaluation_system.mapper.AdminMapper;
import com.evaluation_system.pojo.DTO.FilePageQueryDTO;
import com.evaluation_system.pojo.Result.PageResult;
import com.evaluation_system.pojo.entity.saveFileInfo;
import com.evaluation_system.service.AdminService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;

    @Override
    public PageResult<saveFileInfo> readFile(FilePageQueryDTO filePageQueryDTO) {
        // 分页查询
        PageHelper.startPage(filePageQueryDTO.getPage(), filePageQueryDTO.getPageSize());
        // 执行查询
        Page<saveFileInfo> page = adminMapper.getFile2(filePageQueryDTO);
        return new PageResult<saveFileInfo>(page.getTotal(), page.getResult());
    }
}
